package com.fredia.terp.config;

import java.util.LinkedHashSet;
import java.util.Set;

import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.fredia.terp.temporary.StartCaptchaServlet;
import com.fredia.terp.temporary.VerifyLoginServlet;

@Configuration
public class ServletConfig {
	
	@Bean
	public StartCaptchaServlet startCaptchaServlet() {
		return new StartCaptchaServlet();
	}
	
	@Bean
	public VerifyLoginServlet verifyLoginServlet() {
		return new VerifyLoginServlet();
	}

	@Bean
	public ServletRegistrationBean indexServletRegistration(VerifyLoginServlet verifyLoginServlet) {
		ServletRegistrationBean registration = new ServletRegistrationBean(verifyLoginServlet);
		registration.setEnabled(true);
		registration.addUrlMappings("/ajax-validate2");
		
		return registration;
	}
	
	@Bean
	public ServletRegistrationBean register2(StartCaptchaServlet startCaptchaServlet) {
		ServletRegistrationBean registration = new ServletRegistrationBean(startCaptchaServlet);
		registration.setEnabled(true);
		registration.addUrlMappings("/ajax-register2");
		return registration;
	} 
	//
	// @Bean
	// public FilterRegistrationBean indexFilterRegistration() {
	// FilterRegistrationBean registration = new FilterRegistrationBean(new
	// IndexFilter());
	// registration.addUrlPatterns("/");
	// return registration;
	// }
	//
	// @Bean
	// public ServletListenerRegistrationBean servletListenerRegistrationBean(){
	// ServletListenerRegistrationBean servletListenerRegistrationBean = new
	// ServletListenerRegistrationBean();
	// servletListenerRegistrationBean.setListener(new IndexListener());
	// return servletListenerRegistrationBean;
	// }

}